<template>
	<view class="container">
		<swiper class="swiper" :indicatorDots='true' :autoplay='true' :interval='5000' :circular='true'>
			<block v-for="(item, index) in imgUrls" :key="index">
				<swiper-item>
					<image :src="item"></image>
				</swiper-item>
			</block>
		</swiper>
		<view class="preferred">
			<text>优选精品</text>
			<view class="list">
				<dl>
					<dt>
						<image src="../../static/images/2.png"></image>
					</dt>
					<dd>
						<h2>苏泊尔 自动断电保护 防爆2L热水壶</h2>
						<p>￥198.00</p>
					</dd>
				</dl>
				<dl>
					<dt>
						<image src="../../static/images/2.png"></image>
					</dt>
					<dd>
						<h2>苏泊尔 自动断电保护 防爆2L热水壶</h2>
						<p>￥198.00</p>
					</dd>
				</dl>
				<dl>
					<dt>
						<image src="../../static/images/2.png"></image>
					</dt>
					<dd>
						<h2>苏泊尔 自动断电保护 防爆2L热水壶</h2>
						<p>￥198.00</p>
					</dd>
				</dl>
			</view>
		</view>
		<view class="recommend">
			<text>扶贫优选</text>
			<view class="list">
				<dl>
					<dt>
						<image src="../../static/images/3.jpg"></image>
					</dt>
					<dd>
						<h2>Joyong九阳新款保温电水壶自动断电保护 食品级内胆</h2>
						<p><em>￥</em>198.00</p>
					</dd>
				</dl>
				<dl>
					<dt>
						<image src="../../static/images/3.jpg"></image>
					</dt>
					<dd>
						<h2>Joyong九阳新款保温电水壶自动断电保护 食品级内胆</h2>
						<p><em>￥</em>198.00</p>
					</dd>
				</dl>
				<dl>
					<dt>
						<image src="../../static/images/3.jpg"></image>
					</dt>
					<dd>
						<h2>Joyong九阳新款保温电水壶自动断电保护 食品级内胆</h2>
						<p><em>￥</em>198.00</p>
					</dd>
				</dl>
				<dl>
					<dt>
						<image src="../../static/images/3.jpg"></image>
					</dt>
					<dd>
						<h2>Joyong九阳新款保温电水壶自动断电保护 食品级内胆</h2>
						<p><em>￥</em>198.00</p>
					</dd>
				</dl>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				imgUrls: [
					'../../static/images/1.jpg',
					'../../static/images/1.jpg',
					'../../static/images/1.jpg'
				]
			}
		},
		mounted() {
			this.getHomeSlideFunc()
			
		},
		methods: {
			getHomeSlideFunc() {
				this.$api('home/index/index', params).then(res => {
					
				}).catch(res => {
					console.log(res)
				})
			}
		},
		
	}
</script>

<style lang="scss">
	.container {
		overflow: hidden;
		position: relative;

		&:after {
			content: '';
			width: 1340rpx;
			height: 1340rpx;
			border-radius: 100%;
			position: absolute;
			top: 0;
			left: 50%;
			transform: translate3d(-670rpx, -1060rpx, 0);
			background: #fa7343;
			z-index: -99;
		}
	}

	.swiper {
		width: 710rpx;
		height: 330rpx;
		border-radius: 10rpx;
		overflow: hidden;
		transform: translateY(0);

		image {
			width: 710rpx;
			height: 330rpx;
		}

		.wx-swiper-dot {
			width: 10rpx;
			height: 10rpx;
			background: rgba(255, 255, 255, .7);
			margin: 0 5rpx !important;

			&.wx-swiper-dot-active {
				width: 26rpx;
				border-radius: 6rpx;
				background: rgba(255, 255, 255, 1);
			}
		}

		margin: 30rpx auto;
	}

	.preferred {
		width: 710rpx;
		margin: 30rpx auto;
		background: #fff;
		border-radius: 10rpx;
		box-sizing: border-box;

		text {
			font-size: 36rpx;
			font-weight: 500;
		}

		padding: 30rpx 20rpx;
	}

	//communal
	.list {
		color: #666;
		display: flex;
		justify-content: space-between;
		margin: 24rpx 0 0;
		font-size: 24rpx;

		dl {
			width: 218rpx;

			image {
				width: 218rpx;
				height: 218rpx;
			}

			dd {
				padding: 10rpx 10rpx 0;

				h2 {
					height: 72rpx;
					display: -webkit-box;
					overflow: hidden;
					text-overflow: ellipsis;
					-webkit-line-clamp: 2;
					-webkit-box-orient: vertical;
				}

				p {
					color: #ff5200;
					text-align: center;
				}
			}
		}
	}

	.recommend {
		width: 710rpx;
		margin: 30rpx auto;

		text {
			padding: 0 20rpx;
			font-size: 36rpx;
			font-weight: 500;
		}

		.list {
			flex-wrap: wrap;
			margin: 14rpx 0 0;

			dl {
				width: 350rpx;
				overflow: hidden;
				background: #fff;
				border-radius: 10rpx;
				margin: 10rpx 0 0;

				image {
					width: 350rpx;
					height: 350rpx;
				}

				dd {
					padding: 10rpx 20rpx 20rpx;

					p {
						font-size: 28rpx;
						display: flex;
						align-items: baseline;

						em {
							font-size: 20rpx;
						}
					}
				}
			}
		}
	}
</style>
